package dataThread;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-DD hh:mm:ss");

    public  static String getTime(Date date){
        synchronized(sdf){
            return sdf.format(date);
        }
    }

    public  static Date getDate(String str) throws ParseException {
        synchronized(sdf){
            return sdf.parse(str);
        }
    }
}
